﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.EShop.Bll;
using Runda.EShop.Common.Entity;

namespace Runda.EShop.SaaS.CustomerManage
{
    public partial class ChangePassword : BasePage
    {

        public Guid CustomerID
        {
            get
            {
                return new Guid(Request.QueryString["CustomerID"]);
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SystemBll bll = new SystemBll();
                BizCustomerEntity entity = null;
                entity = bll.Get<BizCustomerEntity>(CustomerID);
                txtAccount.Text = entity.CustomerCode;
                txtUserName.Text = entity.CustomerName;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPwd.Text.Trim(), "MD5");
            CustomerBll bll = new CustomerBll();
            bll.UpdateCustomerPassword(CustomerID, Password);
            ClientScript.RegisterStartupScript(this.GetType(), "SaveAndClose", "alert('保存成功.');parent.$.ligerDialog.hide();", true);
        }
    }
}